<{include file="public/header.html"}>
<link rel="stylesheet" type="text/css" href="/static/default/css/index.css">
<div class="credit-main w1180-con mt20">
    <div class="mb20" style="height: 193px; background: url(/static/default/img/introduce/4.jpg) no-repeat center 0;">
    </div>
    <div class="task_detail m_task_list">
        <h4 class="task-bread-title f-cb" style="font-size: 14px;background: transparent;border: none;padding: 0;margin-bottom: 10px;">
            <div class="fl"><a href="/">首页</a><span style="margin: 0 8px;">&gt;</span><a href="/task.html">溜溜任务</a><span style="margin: 0 8px;">&gt;</span><b style="color:#f07070;">任务详情</b></div>
        </h4>
        <div class="detail">
            <h4>任务详情</h4>
            <div class="task_pd40 left_detail con_detail">

                <p class="tag_p">
                    <{foreach from=$task['task_tags'] item=val}>
                    <span><{$val}></span>
                    <{/foreach}>
                </p>
                <h5 class="f-cb" style="width: 100%;"><{$task['title']}>

                    <span class="fr">
                        <{if $status==1}>

                        <{elseif $status==2}>
                        <a href="javascript:void(0);" onclick="" target="_blank">已结束</a>
                        <{elseif $status==3}>
                        <a href="javascript:void(0);" onclick="" class="take is_taken" target="_blank">已领完</a>
                        <{elseif $status==4}>
                        <a href="javascript:void(0);" onclick="ajaxApply_type(<{$task['tid']}>,<{$task['cate_id']}>,<{$task['_invite']}>);">立即领取</a>
                        <{elseif $status==5 && $left_time}>
                         <{if $task['redirect_url']}>
                            <a href="/task/task_redirect.html?tid=<{$task['tid']}>" target="_blank">去做任务</a>
                         <{/if}>
                        <a href="javascript:void(0);" onclick="showCreditInfo(<{$task['tid']}>,1);">提交验证</a>
                        <{elseif $status==6}>
                        <a href="javascript:void(0);" onclick="showCreditInfo(<{$task['tid']}>,2);">修改验证</a>
                        <a href="/account/taskrec.html" onclick="" target="_blank">查看 </a>
                        <{elseif $status==7}>
                        <a href="/account/taskrec.html" onclick="" target="_blank">查看 </a>
                          <{elseif $status==8}>
                        <a href="/account/taskrec.html" onclick="" target="_blank">查看 </a>
                        <{/if}>
                </span>
                </h5>
                <p>发布人：<span><{$task['username']}></span></p>
                <dl class="f-cb">
                    <dd><b class="icon-limit"></b>
                        <span>任务期限：
                            <{if $status==5 && $left_time}>
                            <label class="red">
                                <i id="day_show"></i><i id="hour_show"></i><i id="minute_show"></i><i id="second_show"></i>
                            </label>
                            <{else}>
                            <label class="red">
                                <i><{$dead_time}>小时</i>
                            </label>
                            <{/if}>
                        </span>
                    </dd>
                    <{if $task['cate_id']==1}>
                    <dd><b class="icon-taskNum"></b><span>剩余数量：<{if $status==2}>0<{else}><{$task['surplus']}><{/if}></span></dd>
                    <dd><b class="icon-commission" style="margin: 0 10px"></b><span>投资金额：<{$task['investment_money']}></span></dd>
                    <dd><b class="icon-commission" style="margin: 0 10px"></b><span>投资天数：<{$task['investment_day']}></span></dd>
                    <dd><b class="icon-commission" style="margin: 0 10px"></b><span>预期总收益：<{$task['profit_amount']}></span></dd>
                    <{/if}>
                    <{if $task['cate_id']==3}>
                    <dd><b class="icon-taskNum"></b><span>投资区间：<{if $status==2}>0<{else}><{$task['min_investment_money']}>-<{$task['max_investment_money']}><{/if}></span></dd>
                    <dd><b class="icon-commission" style="margin: 0 10px"></b><span>剩余金额：<{$task['max_over']}></span></dd>
                    <dd><b class="icon-commission" style="margin: 0 10px"></b><span>投资天数：<{$task['investment_day']}></span></dd>
                    <dd><b class="icon-commission" style="margin: 0 10px"></b><span>佣金比例：<{$task['commission_per']}>%</span></dd>
                    <{/if}>
                    <{if $task['cate_id']==2}>
                    <dd><b class="icon-taskNum"></b><span>任务数量：<{$task['sub_num']}></span></dd>
                    <dd><b class="icon-completed"></b><span>已领取数量：<{$task['snum']}></span></dd>
                    <dd><b class="icon-commission"></b><span>佣金：<{$task['commission']}></span></dd>
                    <{/if}>
                    <input type="hidden" id="input_tid" value="<{$task['tid']}>">
                </dl>
                <p style="color: #f00">免责声明：弹溜溜仅为信息平台，本身不吸纳用户资金。如合作平台出现意外情况，弹溜溜不承担任何责任；请广大投友充分认识投资风险，谨慎投资！</p>
            </div>
        </div>
        <div class="content">
            <h4>任务说明</h4>
            <div class="con_box">
                <div style="margin-bottom:20px">
                    <span>
                        <h3 style="line-height: 45px;">
                            <{if $task['cate_id']==3}>
                                预期总收益 = 佣金金额 + 利息收益 + 红包金额 = <span class="red"><{$task['commission_per']}>%*投资金额 + 投资金额*<{$task['interest_rate']}>% + <{$task['bonus']}>元</span>
                            <{else}>
                                预期总收益构成（佣金：<{$task['commission']}>元<{if $task['cate_id']==1}> + 理财收益：<{$task['expected_money']}>元 + 红包：<{$task['bonus']}>元<{/if}>）
                            <{/if}>
                        </h3>
                        <h3>弹溜溜任务流程：登录弹溜溜账号--领取弹溜溜任务并在规定时间内完成任务--完成后按要求提交任务--审核通过后溜溜币直接发放到弹溜溜账户--提现（绑定支付宝）1-2个工作日到账</h3>
                    </span>
                </div>
                <{$task['description']}>
            </div>
        </div>
        <div class="content">
            <h4>任务教程</h4>
            <div class="con_box">
                <div style="margin-bottom:20px">
                    <span>
                        <h3>验证条件：
                    <{if in_array(1,$task['validate'])}>姓名&nbsp;&nbsp;<{/if}>
                    <{if in_array(2,$task['validate'])}>身份证&nbsp;&nbsp;<{/if}>
                    <{if in_array(3,$task['validate'])}>手机号<{/if}></h3>
                    </span>
                </div>

                <{$task['content']}>
            </div>
        </div>
        <{if $task['img_list']}>
        <div class="content">
            <h4>截图示例</h4>
            <div class="con_box">
                <ul class="ht_ul" id="preview">
                    <{if $task['img_list']}>
                    <{foreach from=$task['img_list'] item=vimgval}>
                    <li style="float: left;"><img src="<{$vimgval}>" width="200"></li>
                    <{/foreach}>
                    <div class="clear"></div>
                    <{/if}>
                </ul>
            </div>
        </div>
        <{/if}>
        <div class="content">
            <h4>推荐任务</h4>
            <div class="con_box recommend-list" style="padding: 0;">
                <ul class="task-list mt30 f-cb">
                    <{foreach from=$recommend_list item=val}>
                    <li style="height: auto;">
                        <div class="list-head f-cb">
                            <img src="<{$val['logo']}>" alt="<{$val['title']}>" class="fl logo">
                            <div class="label-box fr">
                                <{$val['tag_span']}>
                            </div>
                        </div>
                        <div class="list-content">
                            <{if ($val['cate_id']==1)}>
                            <!--预期总收益-->
                            <div class="sort-money f-cb">
                                <div class="title-label fl">理财任务</div>
                                <div class="expect-return fl">
                                    <h5 style="width: auto;"><b><{$val['profit_amount']}></b>元</h5>
                                    <p>预期总收益</p>
                                </div>
                            </div>
                            <!--投资金额、周期-->
                            <div class="amount-cycle f-cb" style="margin: 0;">
                                <div class="fl amount">
                                    <p><{$val['investment_money']}>元</p><span>投资金额</span>
                                </div>
                                <div class="fr cycle">
                                    <p><{$val['investment_day']}>天</p><span>投资周期</span>
                                </div>
                            </div>
                            <{/if}>
                            <{if ($val['cate_id']==3)}>
                            <!--预期总收益-->
                            <div class="sort-money f-cb">
                                <div class="title-label fl">区间理财</div>
                                <div class="expect-return fl">
                                    <h5 style="width: auto;"><b><{$val['max_profit_amount']}></b>元</h5>
                                    <p>预期总收益</p>
                                </div>
                            </div>
                            <!--投资金额、周期-->
                            <div class="amount-cycle f-cb" style="margin: 0;">
                                <div class="fl amount">
                                    <p><{$val['max_investment_money']}>元</p><span>投资金额</span>
                                </div>
                                <div class="fr cycle">
                                    <p><{$val['investment_day']}>天</p><span>投资周期</span>
                                </div>
                            </div>
                            <{/if}>
                            <{if ($val['cate_id']==2)}>
                            <div class="sort-money f-cb">
                                <div class="title-label fl">注册任务</div>
                                <div class="expect-return fl">
                                    <h5 style="width: auto;"><b><{$val['commission']}></b>元</h5>
                                    <p>佣金</p>
                                </div>
                            </div>
                            <div class="amount-cycle f-cb" style="margin: 0;">
                                <p class="item-title textnum35"><{$val['title']}></p>
                            </div>
                            <{/if}>
                            <!--查看-->
                            <div class="look-box"><a href="<{$val['link.']}>" class="look-btn">查看</a></div>
                            <!--剩余数量-->
                            <{if ($val['cate_id']==3)}>
                            <div class="last-amount f-cb">
                                <span class="txt">剩余额度</span>
                                <div class="loadbox">
                                    <dl class="big-barbox">
                                        <dd class="barline">
                                            <div style="width: <{$val['overplus_money']}>%;" class="charts"></div>
                                        </dd>
                                    </dl>
                                </div>
                                <span style="margin-top: 1px;" class="txt"><font><{$val['surplus_money']}></font>/<{$val['investment_money_amount']}></span>
                            </div>
                            <{else}>
                            <div class="last-amount f-cb">
                                <span class="txt">剩余数量</span>
                                <div class="loadbox">
                                    <dl class="big-barbox">
                                        <dd class="barline">
                                            <div style="width: <{$val['overplus']}>%;" class="charts"></div>
                                        </dd>
                                    </dl>
                                </div>
                                <span style="margin-top: 1px;" class="txt"><font><{$val['surplus']}></font>/<{$val['sub_num']}></span>
                            </div>
                            <{/if}>
                        </div>
                    </li>
                    <{/foreach}>
                </ul>

                <p style="text-align: right"><a href="/task.html" class="colred" style="font-size: 16px;">更多任务 &gt;&gt;</a></p>
            </div>
        </div>
    </div>
</div>

<style>
    .ht_ul{
        width: 100%;
        height: auto;
    }
    .ht_ul li{
        border: 1px solid #e5e5e5;
        margin-right: 10px !important;
        width: auto;
        padding: 10px;
    }
    .ht_div{
        width: 456px;
        margin-left: auto;
        margin-right: auto;
    }
    .ht_div div{
        margin: 20px 0 0 30px;
        line-height: 40px;
    }
    .ht_div p{
        width: 70px;
    }
    .ht_div input{
        line-height: 40px;
        width: 321px;
        text-indent: 10px;
        border-radius: 3px;
        border: 1px solid #8f8f94;
    }
</style>
<div class="ht_div" style="display: none;">
    <{if $task['_invite']==1}>
    <div>
        <p class="fl">邀请码：</p>
        <input class="fl" type="text" id="invite_code" value="" placeholder="请输入邀请码">
        <div class="clear"></div>
    </div>
    <{/if}>
    <{if $task['cate_id']==3}>
    <div>
        <p class="fl">投资金额：</p>
        <input class="fl" type="number" id="investment_money" min="<{$task['min_over']}>" max="<{$task['can_recive_money']}>" value="" placeholder="请输入投资金额,当前可申请<{$task['min_over']}>-<{$task['can_recive_money']}>">
        <div class="clear"></div>
    </div>
    <{/if}>
</div>
<!--footer-->
<script type="text/javascript">

    var intDiff = parseInt(<{$left_time}>);//倒计时总秒数量
    function timer(intDiff){
        window.setInterval(function(){
            var day=0,hour=0,minute=0,second=0;//时间默认值
            if(intDiff > 0){
                day = Math.floor(intDiff / (60 * 60 * 24));
                hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
            }
            if (minute <= 9) minute = '0' + minute;
            if (second <= 9) second = '0' + second;

            day > 0 ? $('#day_show').html(day+"天") : $('#day_show').html('');
            hour > 0 ? $('#hour_show').html(hour+'小时') : $('#hour_show').html('');
            $('#minute_show').html(minute+'分');
            $('#second_show').html(second+'秒');

            intDiff--;
        }, 1000);
    }
    $(function(){
        timer(intDiff);
    });
    function showCreditInfo(TID,type){
        var title = type==1 ? '提交验证':'修改验证';
        layer.open({
            type: 2,
            title: title,
            shadeClose: true,
            shade: 0.8,
            area: ['900px', '700px'],
            content: '/task/info.html?tid='+TID,
        });
//        var params = {};
//        params.id = ID;
//        doRequest("/task/info.html",params,false,function(data){$("body").find(".popup-credit,.popup-credit-sign").remove().end().append(data.data);},errorCallback);
    }
    //异步申请任务，也就是提交子任务
    function ajaxApply(tid,invite_code,investment_money){
        var params = {};
        if (invite_code){
            params.invite_code = invite_code;
        }
        if (investment_money){
            params.investment_money = investment_money;
        }
        params.tid = tid;
        doRequest("/task/ajax_apply.html",params,false,function(data){
            $("body").find(".popup-credit,.popup-credit-sign").remove().end().append(data.data);
            layer.msg(data.msg,{icon:0,time:2000,offset:300}, function(){
                location.href=data.link;
            });
        },errorCallback);
    }

    //异步申请任务，也就是提交子任务
    function ajaxApply_type(tid,cate_id,_invite){
        if(cate_id==3 || _invite==1){
            layer.open({
                type: 1,
                title: "确认申请信息",
                content: $('.ht_div'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                btn:['确认','取消'],
                area: ['456px', 'auto'],
                yes: function(){
                    var invite_code = $("#invite_code").val();
                    var investment_money = $("#investment_money").val();
                    var min = $("#investment_money").attr('min');
                    var max = $("#investment_money").attr('max');
                    if(_invite==1 && invite_code.length==0){
                        layer.msg("请输入邀请码", {icon: 0});
                        return;
                    }
                    if(cate_id==3 && investment_money.length==0){
                        layer.msg("请输入投资金额", {icon: 0});
                        return;
                    }else if(Number(investment_money)<min || Number(investment_money)>max){
                        layer.msg("投资金额必须在"+min+"-"+max+"之间", {icon: 0});
                        return;
                    }

                    ajaxApply(tid,invite_code,investment_money);
                }
            });
        }else{
            ajaxApply(tid);
        }
    }
    //提交认证信息
    function submitValidate(){
        var params = {};
        var tid = $("#input_tid").val();
        var validate = $("#input_validate").val();
        //layer.msg("请输入问答标题",{icon:0,time:2000,shift:6,offset:300});return false;
        params.tid = tid;
        params.validate = validate;
//        doRequest("/task/update_subtask.html",params,false,successLoadCredit,errorCallback);
//        //刷新页面
//        location.reload();

        doRequest("/task/update_subtask.html",params,false,function(data){
            $("body").find(".popup-credit,.popup-credit-sign").remove().end().append(data.data);
            layer.msg(data.msg,{icon:0,time:1000,offset:300});

            setTimeout(function(

            ){
                location.reload();
            },1000);


        },errorCallback);
        //location.href('www.baidu.com');
    }
    function successLoadCredit(resp){
        var totalCount = resp.data.totalCount;
        var str = "";
        if(totalCount == 0){
            str += "<div class='no-card'><b class='icon icon-hasno'></b>没有找到符合您筛选条件的信用卡，您可以重新选择!</div>";
        }
        var list = resp.data.list;
        $.each(list,function(index,data){
            str +=  data.str;
        });

        $(".credit-card-list").html(str);
        creditPage(totalCount,resp.data.pageIndex);
    }
    function loadCredit(pageIndex){
        var obj = $(".credit-classify .hover-style");
        var str = "";
        obj.each(function(){
            str += $(this).attr("data-id")+",";
        });
        str = str.substr(0,str.length-1);
        var params = {};
        params.type = str;
        params.pageIndex = pageIndex;
        //doRequest("/card/mlist.html",params,false,successLoadCredit,errorCallback);
        doRequest("/card/info.html",params,false,successLoadCredit,errorCallback);
    }

    function creditPage(total,pageIndex){
        $("#credit_pagination").pagination(total, { //recordCount在后台定义的一个公有变量，通过从数据库查询记录进行赋值，返回记录的总数
            callback: loadCredit,  //点击分页时，调用的回调函数
            prev_text: '<',  //显示上一页按钮的文本
            next_text: '>',  //显示下一页按钮的文本
            link_to:"javascript:void(0);",
            items_per_page:10,  //每页显示的项数
            num_display_entries:6,  //分页插件中间显示的按钮数目
            current_page:pageIndex,  //当前页索引
            num_edge_entries:2  //分页插件左右两边显示的按钮数目
        });
    }

    /**
     * credit-card detail 弹窗
     * */
    $("body").delegate('.popup-credit-sign .icon-close','click',function(){
        $(this).parents('.popup-credit-sign').fadeOut();
        $('.popup-credit').fadeOut();
    });
    $("body").delegate('.popup-credit-sign .tab span','click',function(){
        index = $(this).parent().children().index($(this));
        $('.popup-credit-sign .credit-con .credit-txt').eq(index).fadeIn().siblings().hide();
        $(this).addClass('popup-credit-line').siblings().removeClass('popup-credit-line');
    });
    /**
     * credit-card 类别 click effect
     * */
    $(function(){
        loadCredit(0);
        var obj=$(".credit-classify.clear");
        obj.each(function()
        {
            var _this=this;
            $( "li a,.credit-selected.hover-style",this).click(function()
            {
                $( "li a,.credit-selected.hover-style",_this).removeClass("hover-style")
                $(this).addClass("hover-style");
                $(this).removeClass("hovering");

                loadCredit(0);
            })
        })
    });


</script>
<{include file="public/footer.html"}>